from lab.blog.models import Tag, Post
from django.template import Library, Node

register = Library()

def build_month_list(parser, token):
    """
    {% get_month_list %}
    """
    return MonthMenuObject()

class MonthMenuObject(Node):
    def render(self, context):
        context['blog_months'] = Post.objects.dates("create_date", "month")
        return ''

register.tag('get_month_list', build_month_list)